<!DOCTYPE html>
<html lang = "en">
    <head>
        <title>v-model</title>
    </head>

    <body>

        <div id = "app">
            <input type = "button" value = "修改message" @click = "setM">
            <input type = "text" v-model = "message" @keyup.enter = "getM">
        </div>
        <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
        <script>
            var app = new Vue({

                el:"#app",
                data: {
                    message:"Hi~"
                },
                methods: {
                    getM:function() {
                        alert(this.message);
                    },
                    setM:function() {
                        this.message = "Hello~";
                    }
                }
            })
        </script>

    </body>
</html>